using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.Task.Data;

using HistoryTable = CentralOffice.Task.Data.TaskHistoryDataSet.TaskHistoryDataTable;
using HistoryRow = CentralOffice.Task.Data.TaskHistoryDataSet.TaskHistoryRow;


namespace CentralOffice.Task.DataAccess
{
    public class TaskHistoryAdapter : DataAccessAdapter<TaskHistoryDataSet, HistoryTable, HistoryRow>
    {
        public TaskHistoryAdapter()
        {
            //this.TableName = "EnterpriseCategory";
            this.MasterFieldName = "TaskId";

            GetAllStoredProc = "Tasks.TaskHistory_SelectTaskHistoriesAll";
            InsertStoredProc = "Tasks.TaskHistory_InsertTaskHistory";
            UpdateStoredProc = "Tasks.TaskHistory_UpdateTaskHistory";
            DeleteStoredProc = "Tasks.TaskHistory_DeleteTaskHistory";

            GetByIdStoredProc = "Tasks.TaskHistory_SelectTaskHistory";
            this.GetByMasterIdStoredProc = "Tasks.TaskHistory_SelectTaskHistoryByTaskId";
        }
        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "Id", DbType.Guid, "Id", DataRowVersion.Current);
            db.AddInParameter(cmd, "TaskId", DbType.Guid, "TaskId", DataRowVersion.Current);
            db.AddInParameter(cmd, "Operator", DbType.String, "Operator", DataRowVersion.Current);
            db.AddInParameter(cmd, "DateModified", DbType.DateTime, "DateModified", DataRowVersion.Current);
            db.AddInParameter(cmd, "PostType", DbType.Int32, "PostType", DataRowVersion.Current);
            db.AddInParameter(cmd, "PostId", DbType.Guid, "PostId", DataRowVersion.Current);
            db.AddInParameter(cmd, "Comment", DbType.String, "Comment", DataRowVersion.Current);
        }
    }
}
